function [ W1, H1 ] = TNMF( duomenys, R, niter)

    M = size(duomenys, 1);
    N = size(duomenys, 2);
    
    
    W1 = rand(M, R);
    H1 = rand(R, N);
    
    Y = duomenys;
    
    %[W1 H1] = GetStartingWH(M, N, R);
    [W1 H1] = GetStartingWHMySVD(duomenys, R);
    %[W1 H1] = GetStartingWHProport(duomenys, R);
    %[W1 H1] = NNDSVD(duomenys, R, 0);
    
    ee = 1e-6;
    
    for k=1:niter
        
        W1 = W1 .* (Y * H1' )./((W1*H1)*H1' + ee);
        H1 = H1 .* (W1' * Y )./(W1'*W1*H1 + ee);
        
        dist = EuclidDist(duomenys, W1 * H1);
    end
    
    
end
